﻿/********************************************************************
FileName    :   Bll_OS.cs
CreateTime  :   2020-09-19 03:07:29
BaseClass   :   Bll_OS
FileType    :   .cs
Author      :  minjie
*********************************************************************/


using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;

using System.Data;
namespace OS.DAL
{
    /// <summary>
    /// Dal_zwcl_kczbH的摘要说明。
    /// </summary>
    public partial class Dal_zwcl_kczbH
    {
        /// <summary> 
        /// 更新一条数据(字符串) 2016-07-13更新 
        ///   2020-04-09 更新 minjie 
        /// </summary> 
        public string UpdateStr(zwcl_kczbH_Entity model)
        {
		   StringBuilder strSql = new StringBuilder();
           strSql.Append("update zwcl_kczbH set ");
		
	     if (model.DjLsh != null) 
			 strSql.Append(" DjLsh ='" + model.DjLsh + "',");
	 
	     if (model.DjBtZdh != null) 
			 strSql.Append(" DjBtZdh ='" + model.DjBtZdh + "',");
	 
	     if (model.DjFtZdh != null) 
			 strSql.Append(" DjFtZdh ='" + model.DjFtZdh + "',");
	 
	     if (model.DjStZdh != null) 
			 strSql.Append(" DjStZdh ='" + model.DjStZdh + "',");
	 
	     if (model.DjState != null) 
			 strSql.Append(" DjState ='" + model.DjState + "',");
	 
	     if (model.DjCount != null) 
			 strSql.Append(" DjCount ='" + model.DjCount + "',");
	 
	     if (model.yy != null) 
			 strSql.Append(" yy ='" + model.yy + "',");
	 
	     if (model.mm != null) 
			 strSql.Append(" mm ='" + model.mm + "',");
	 
	     if (model.ckbh != null) 
			 strSql.Append(" ckbh ='" + model.ckbh + "',");
	 
	     if (model.ckmc != null) 
			 strSql.Append(" ckmc ='" + model.ckmc + "',");
	 
	     if (model.spbh != null) 
			 strSql.Append(" spbh ='" + model.spbh + "',");
	 
	     if (model.spmc != null) 
			 strSql.Append(" spmc ='" + model.spmc + "',");
	 
	     if (model.qcsl != null) 
			 strSql.Append(" qcsl ='" + model.qcsl + "',");
	 
	     if (model.qcje != null) 
			 strSql.Append(" qcje ='" + model.qcje + "',");
	 
	     if (model.jssl != null) 
			 strSql.Append(" jssl ='" + model.jssl + "',");
	 
	     if (model.jsje != null) 
			 strSql.Append(" jsje ='" + model.jsje + "',");
	 
	     if (model.fcsl != null) 
			 strSql.Append(" fcsl ='" + model.fcsl + "',");
	 
	     if (model.fcje != null) 
			 strSql.Append(" fcje ='" + model.fcje + "',");
	 
	     if (model.tzsl != null) 
			 strSql.Append(" tzsl ='" + model.tzsl + "',");
	 
	     if (model.tzje != null) 
			 strSql.Append(" tzje ='" + model.tzje + "',");
	 
	     if (model.qmsl != null) 
			 strSql.Append(" qmsl ='" + model.qmsl + "',");
	 
	     if (model.qmje != null) 
			 strSql.Append(" qmje ='" + model.qmje + "',");
	 
	     if (model.cgthsl != null) 
			 strSql.Append(" cgthsl ='" + model.cgthsl + "',");
	 
	     if (model.cgthje != null)
			 strSql.Append(" cgthje ='" + model.cgthje + "'");
			
	 
	    strSql.Append(" where  DjLsh ='" + model.DjLsh + "' ");
        return strSql.ToString();
        }
		
		/// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="DjLsh">主键</param>
        /// <returns></returns>
        public bool Exists(int DjLsh)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from zwcl_kczbH");  
            strSql.Append(" where   DjLsh =@DjLsh ");
            SqlParameter[] parameters = {  new SqlParameter("@DjLsh",SqlDbType.Int,4) };
            parameters[0].Value = DjLsh;
            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }
		/// <summary> 
        /// 增加一条数据 
        /// </summary> 
        public bool Add(zwcl_kczbH_Entity model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into zwcl_kczbH (");
			strSql.Append("DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,yy,mm,ckbh,ckmc,spbh,spmc,qcsl,qcje,jssl,jsje,fcsl,fcje,tzsl,tzje,qmsl,qmje,cgthsl, cgthje) values (");
	        strSql.Append("@DjLsh,@DjBtZdh,@DjFtZdh,@DjStZdh,@DjState,@DjCount,@yy,@mm,@ckbh,@ckmc,@spbh,@spmc,@qcsl,@qcje,@jssl,@jsje,@fcsl,@fcje,@tzsl,@tzje,@qmsl,@qmje,@cgthsl,@cgthje) ");  
	        SqlParameter[] parameters = {
	       
			new SqlParameter("@DjLsh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjBtZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjFtZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjStZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjState",SqlDbType.Char,10),
	 
			new SqlParameter("@DjCount",SqlDbType.Int,4),
	 
			new SqlParameter("@yy",SqlDbType.Int,4),
	 
			new SqlParameter("@mm",SqlDbType.Int,4),
	 
			new SqlParameter("@ckbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@ckmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@spbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@spmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@qcsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@qcje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jssl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jsje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@fcsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@fcje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@tzsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@tzje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@qmsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@qmje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@cgthsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@cgthje",SqlDbType.Decimal,9)
	 };
 	  
	 	if (model.DjLsh.ToString() != null)
            parameters[0].Value = model.DjLsh;
		else
		    parameters[0].Value =0;
	  
	 	if (model.DjBtZdh.ToString() != null)
            parameters[1].Value = model.DjBtZdh;
		else
		    parameters[1].Value =0;
	  
	 	if (model.DjFtZdh.ToString() != null)
            parameters[2].Value = model.DjFtZdh;
		else
		    parameters[2].Value =0;
	  
	 	if (model.DjStZdh.ToString() != null)
            parameters[3].Value = model.DjStZdh;
		else
		    parameters[3].Value =0;
	  
		if (model.DjState != null)
            parameters[4].Value = model.DjState;
		else
		    parameters[4].Value =DBNull.Value;
		 
	  
	 	if (model.DjCount.ToString() != null)
            parameters[5].Value = model.DjCount;
		else
		    parameters[5].Value =0;
	  
	 	if (model.yy.ToString() != null)
            parameters[6].Value = model.yy;
		else
		    parameters[6].Value =0;
	  
	 	if (model.mm.ToString() != null)
            parameters[7].Value = model.mm;
		else
		    parameters[7].Value =0;
	  
		if (model.ckbh != null)
            parameters[8].Value = model.ckbh;
		else
		    parameters[8].Value =DBNull.Value;
		 
	  
		if (model.ckmc != null)
            parameters[9].Value = model.ckmc;
		else
		    parameters[9].Value =DBNull.Value;
		 
	  
		if (model.spbh != null)
            parameters[10].Value = model.spbh;
		else
		    parameters[10].Value =DBNull.Value;
		 
	  
		if (model.spmc != null)
            parameters[11].Value = model.spmc;
		else
		    parameters[11].Value =DBNull.Value;
		 
	  
	 	if (model.qcsl.ToString() != null)
            parameters[12].Value = model.qcsl;
		else
		    parameters[12].Value =0;
	  
	 	if (model.qcje.ToString() != null)
            parameters[13].Value = model.qcje;
		else
		    parameters[13].Value =0;
	  
	 	if (model.jssl.ToString() != null)
            parameters[14].Value = model.jssl;
		else
		    parameters[14].Value =0;
	  
	 	if (model.jsje.ToString() != null)
            parameters[15].Value = model.jsje;
		else
		    parameters[15].Value =0;
	  
	 	if (model.fcsl.ToString() != null)
            parameters[16].Value = model.fcsl;
		else
		    parameters[16].Value =0;
	  
	 	if (model.fcje.ToString() != null)
            parameters[17].Value = model.fcje;
		else
		    parameters[17].Value =0;
	  
	 	if (model.tzsl.ToString() != null)
            parameters[18].Value = model.tzsl;
		else
		    parameters[18].Value =0;
	  
	 	if (model.tzje.ToString() != null)
            parameters[19].Value = model.tzje;
		else
		    parameters[19].Value =0;
	  
	 	if (model.qmsl.ToString() != null)
            parameters[20].Value = model.qmsl;
		else
		    parameters[20].Value =0;
	  
	 	if (model.qmje.ToString() != null)
            parameters[21].Value = model.qmje;
		else
		    parameters[21].Value =0;
	  
	 	if (model.cgthsl.ToString() != null)
            parameters[22].Value = model.cgthsl;
		else
		    parameters[22].Value =0;
	  
	 	if (model.cgthje.ToString() != null)
            parameters[23].Value = model.cgthje;
		else
		    parameters[23].Value =0;
	 
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary> 
        /// 增加一条数据(字符串) 
        /// </summary> 
        public string AddStr(zwcl_kczbH_Entity model)
        {
		    StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into zwcl_kczbH(");
			strSql.Append("DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,yy,mm,ckbh,ckmc,spbh,spmc,qcsl,qcje,jssl,jsje,fcsl,fcje,tzsl,tzje,qmsl,qmje,cgthsl, cgthje) values (");
            strSql.Append("'" + model.DjLsh + "','" + model.DjBtZdh + "','" + model.DjFtZdh + "','" + model.DjStZdh + "','" + model.DjState + "','" + model.DjCount + "','" + model.yy + "','" + model.mm + "','" + model.ckbh + "','" + model.ckmc + "','" + model.spbh + "','" + model.spmc + "','" + model.qcsl + "','" + model.qcje + "','" + model.jssl + "','" + model.jsje + "','" + model.fcsl + "','" + model.fcje + "','" + model.tzsl + "','" + model.tzje + "','" + model.qmsl + "','" + model.qmje + "','" + model.cgthsl + "','" + model.cgthje + "') ");  
            return strSql.ToString();
        }
		/// <summary> 
        /// 更新一条数据 
		///创建时间:2020-04-09
		///创建人:minjie
        /// </summary> 
        public bool Update(zwcl_kczbH_Entity model)
        {
		   StringBuilder strSql = new StringBuilder();
           strSql.Append("update zwcl_kczbH set ");
		strSql.Append(" DjLsh = @DjLsh,");
		 
	 strSql.Append(" DjBtZdh = @DjBtZdh,");
		 
	 strSql.Append(" DjFtZdh = @DjFtZdh,");
		 
	 strSql.Append(" DjStZdh = @DjStZdh,");
		 
	 strSql.Append(" DjState = @DjState,");
		 
	 strSql.Append(" DjCount = @DjCount,");
		 
	 strSql.Append(" yy = @yy,");
		 
	 strSql.Append(" mm = @mm,");
		 
	 strSql.Append(" ckbh = @ckbh,");
		 
	 strSql.Append(" ckmc = @ckmc,");
		 
	 strSql.Append(" spbh = @spbh,");
		 
	 strSql.Append(" spmc = @spmc,");
		 
	 strSql.Append(" qcsl = @qcsl,");
		 
	 strSql.Append(" qcje = @qcje,");
		 
	 strSql.Append(" jssl = @jssl,");
		 
	 strSql.Append(" jsje = @jsje,");
		 
	 strSql.Append(" fcsl = @fcsl,");
		 
	 strSql.Append(" fcje = @fcje,");
		 
	 strSql.Append(" tzsl = @tzsl,");
		 
	 strSql.Append(" tzje = @tzje,");
		 
	 strSql.Append(" qmsl = @qmsl,");
		 
	 strSql.Append(" qmje = @qmje,");
		 
	 strSql.Append(" cgthsl = @cgthsl,");
		 
	 strSql.Append(" cgthje = @cgthje");
			
	 
		  strSql.Append(" where  DjLsh =@DjLsh");
		  SqlParameter[] parameters = {
	       
			new SqlParameter("@DjLsh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjBtZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjFtZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjStZdh",SqlDbType.Int,4),
	 
			new SqlParameter("@DjState",SqlDbType.Char,10),
	 
			new SqlParameter("@DjCount",SqlDbType.Int,4),
	 
			new SqlParameter("@yy",SqlDbType.Int,4),
	 
			new SqlParameter("@mm",SqlDbType.Int,4),
	 
			new SqlParameter("@ckbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@ckmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@spbh",SqlDbType.VarChar,50),
	 
			new SqlParameter("@spmc",SqlDbType.VarChar,50),
	 
			new SqlParameter("@qcsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@qcje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jssl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@jsje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@fcsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@fcje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@tzsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@tzje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@qmsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@qmje",SqlDbType.Decimal,9),
	 
			new SqlParameter("@cgthsl",SqlDbType.Decimal,9),
	 
			new SqlParameter("@cgthje",SqlDbType.Decimal,9)
	 };
	  
	 	if (model.DjLsh.ToString() != null)
            parameters[0].Value = model.DjLsh;
		else
		    parameters[0].Value =0;
	  
	 	if (model.DjBtZdh.ToString() != null)
            parameters[1].Value = model.DjBtZdh;
		else
		    parameters[1].Value =0;
	  
	 	if (model.DjFtZdh.ToString() != null)
            parameters[2].Value = model.DjFtZdh;
		else
		    parameters[2].Value =0;
	  
	 	if (model.DjStZdh.ToString() != null)
            parameters[3].Value = model.DjStZdh;
		else
		    parameters[3].Value =0;
	  
		if (model.DjState != null)
            parameters[4].Value = model.DjState;
		else
		    parameters[4].Value =DBNull.Value;
		 
	  
	 	if (model.DjCount.ToString() != null)
            parameters[5].Value = model.DjCount;
		else
		    parameters[5].Value =0;
	  
	 	if (model.yy.ToString() != null)
            parameters[6].Value = model.yy;
		else
		    parameters[6].Value =0;
	  
	 	if (model.mm.ToString() != null)
            parameters[7].Value = model.mm;
		else
		    parameters[7].Value =0;
	  
		if (model.ckbh != null)
            parameters[8].Value = model.ckbh;
		else
		    parameters[8].Value =DBNull.Value;
		 
	  
		if (model.ckmc != null)
            parameters[9].Value = model.ckmc;
		else
		    parameters[9].Value =DBNull.Value;
		 
	  
		if (model.spbh != null)
            parameters[10].Value = model.spbh;
		else
		    parameters[10].Value =DBNull.Value;
		 
	  
		if (model.spmc != null)
            parameters[11].Value = model.spmc;
		else
		    parameters[11].Value =DBNull.Value;
		 
	  
	 	if (model.qcsl.ToString() != null)
            parameters[12].Value = model.qcsl;
		else
		    parameters[12].Value =0;
	  
	 	if (model.qcje.ToString() != null)
            parameters[13].Value = model.qcje;
		else
		    parameters[13].Value =0;
	  
	 	if (model.jssl.ToString() != null)
            parameters[14].Value = model.jssl;
		else
		    parameters[14].Value =0;
	  
	 	if (model.jsje.ToString() != null)
            parameters[15].Value = model.jsje;
		else
		    parameters[15].Value =0;
	  
	 	if (model.fcsl.ToString() != null)
            parameters[16].Value = model.fcsl;
		else
		    parameters[16].Value =0;
	  
	 	if (model.fcje.ToString() != null)
            parameters[17].Value = model.fcje;
		else
		    parameters[17].Value =0;
	  
	 	if (model.tzsl.ToString() != null)
            parameters[18].Value = model.tzsl;
		else
		    parameters[18].Value =0;
	  
	 	if (model.tzje.ToString() != null)
            parameters[19].Value = model.tzje;
		else
		    parameters[19].Value =0;
	  
	 	if (model.qmsl.ToString() != null)
            parameters[20].Value = model.qmsl;
		else
		    parameters[20].Value =0;
	  
	 	if (model.qmje.ToString() != null)
            parameters[21].Value = model.qmje;
		else
		    parameters[21].Value =0;
	  
	 	if (model.cgthsl.ToString() != null)
            parameters[22].Value = model.cgthsl;
		else
		    parameters[22].Value =0;
	  
	 	if (model.cgthje.ToString() != null)
            parameters[23].Value = model.cgthje;
		else
		    parameters[23].Value =0;
	 
	             int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary> 
        /// 删除一条数据 
        /// </summary> 
        public bool Delete(int DjLsh)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from zwcl_kczbH ");
            strSql.Append(" where   DjLsh =@DjLsh ");
            SqlParameter[] parameters = {  new SqlParameter("@DjLsh",SqlDbType.Int,4) };
            parameters[0].Value = DjLsh;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary> 
        /// 批量删除一批数据 
        /// </summary> 
        public bool DeleteList(string lists)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from sys_Config ");
            strSql.Append(" where DjLsh in (" + lists + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		
		/// <summary> 
        /// 得到一个对象实体 
        /// </summary> 
        public zwcl_kczbH_Entity GetModel(int DjLsh)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top 1  DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,yy,mm,ckbh,ckmc,spbh,spmc,qcsl,qcje,jssl,jsje,fcsl,fcje,tzsl,tzje,qmsl,qmje,cgthsl, cgthje ");
            strSql.Append(" from zwcl_kczbH ");
            zwcl_kczbH_Entity model = new zwcl_kczbH_Entity();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            DataTable dt = ds.Tables[0];
            return DataTableToEntity(dt);
        }
		/// <summary> 
        /// 将数据集(DataTable)转换 对象 zwcl_kczbH_Entity
        /// 创建人：minjie 
        /// 创建时间:2019-02-18 02:05:58 
        /// </summary> 
        public zwcl_kczbH_Entity DataTableToEntity(DataTable dt)
        {
          zwcl_kczbH_Entity model = new zwcl_kczbH_Entity(); 
            if (dt != null && dt.Rows.Count > 0)
            {
		    
			   if (dt.Rows[0]["DjLsh"] != null && dt.Rows[0]["DjLsh"].ToString() != "")
                model.DjLsh = int.Parse(dt.Rows[0]["DjLsh"].ToString());
			  
	        
			   if (dt.Rows[0]["DjBtZdh"] != null && dt.Rows[0]["DjBtZdh"].ToString() != "")
                model.DjBtZdh = int.Parse(dt.Rows[0]["DjBtZdh"].ToString());
			  
	        
			   if (dt.Rows[0]["DjFtZdh"] != null && dt.Rows[0]["DjFtZdh"].ToString() != "")
                model.DjFtZdh = int.Parse(dt.Rows[0]["DjFtZdh"].ToString());
			  
	        
			   if (dt.Rows[0]["DjStZdh"] != null && dt.Rows[0]["DjStZdh"].ToString() != "")
                model.DjStZdh = int.Parse(dt.Rows[0]["DjStZdh"].ToString());
			  
	        model.DjState = dt.Rows[0]["DjState"].ToString();
	        
			   if (dt.Rows[0]["DjCount"] != null && dt.Rows[0]["DjCount"].ToString() != "")
                model.DjCount = int.Parse(dt.Rows[0]["DjCount"].ToString());
			  
	        
			   if (dt.Rows[0]["yy"] != null && dt.Rows[0]["yy"].ToString() != "")
                model.yy = int.Parse(dt.Rows[0]["yy"].ToString());
			  
	        
			   if (dt.Rows[0]["mm"] != null && dt.Rows[0]["mm"].ToString() != "")
                model.mm = int.Parse(dt.Rows[0]["mm"].ToString());
			  
	        model.ckbh = dt.Rows[0]["ckbh"].ToString();
	        model.ckmc = dt.Rows[0]["ckmc"].ToString();
	        model.spbh = dt.Rows[0]["spbh"].ToString();
	        model.spmc = dt.Rows[0]["spmc"].ToString();
	        if (dt.Rows[0]["qcsl"] != null && dt.Rows[0]["qcsl"].ToString() != "")
			  model.qcsl = decimal.Parse(dt.Rows[0]["qcsl"].ToString());
			
	        if (dt.Rows[0]["qcje"] != null && dt.Rows[0]["qcje"].ToString() != "")
			  model.qcje = decimal.Parse(dt.Rows[0]["qcje"].ToString());
			
	        if (dt.Rows[0]["jssl"] != null && dt.Rows[0]["jssl"].ToString() != "")
			  model.jssl = decimal.Parse(dt.Rows[0]["jssl"].ToString());
			
	        if (dt.Rows[0]["jsje"] != null && dt.Rows[0]["jsje"].ToString() != "")
			  model.jsje = decimal.Parse(dt.Rows[0]["jsje"].ToString());
			
	        if (dt.Rows[0]["fcsl"] != null && dt.Rows[0]["fcsl"].ToString() != "")
			  model.fcsl = decimal.Parse(dt.Rows[0]["fcsl"].ToString());
			
	        if (dt.Rows[0]["fcje"] != null && dt.Rows[0]["fcje"].ToString() != "")
			  model.fcje = decimal.Parse(dt.Rows[0]["fcje"].ToString());
			
	        if (dt.Rows[0]["tzsl"] != null && dt.Rows[0]["tzsl"].ToString() != "")
			  model.tzsl = decimal.Parse(dt.Rows[0]["tzsl"].ToString());
			
	        if (dt.Rows[0]["tzje"] != null && dt.Rows[0]["tzje"].ToString() != "")
			  model.tzje = decimal.Parse(dt.Rows[0]["tzje"].ToString());
			
	        if (dt.Rows[0]["qmsl"] != null && dt.Rows[0]["qmsl"].ToString() != "")
			  model.qmsl = decimal.Parse(dt.Rows[0]["qmsl"].ToString());
			
	        if (dt.Rows[0]["qmje"] != null && dt.Rows[0]["qmje"].ToString() != "")
			  model.qmje = decimal.Parse(dt.Rows[0]["qmje"].ToString());
			
	        if (dt.Rows[0]["cgthsl"] != null && dt.Rows[0]["cgthsl"].ToString() != "")
			  model.cgthsl = decimal.Parse(dt.Rows[0]["cgthsl"].ToString());
			
	        if (dt.Rows[0]["cgthje"] != null && dt.Rows[0]["cgthje"].ToString() != "")
			  model.cgthje = decimal.Parse(dt.Rows[0]["cgthje"].ToString());
			
	        
                return model;
            }
            else
            {
                return null;
            }
        }
		
		
		
		/// <summary> 
        /// 执行sql语句  
        /// </summary> 
        public string GetSingle(string sql)
        {
            object obj = DbHelperSQL.GetSingle(sql);
            if (obj != null)
            {
                return obj.ToString();
            }
            else
                return "";
        }
		/// <summary> 
        /// 获得记录条数 
        /// </summary> 
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) ");
            strSql.Append(" FROM zwcl_kczbH ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj != null && obj.ToString() != "")
                return Convert.ToInt32(obj);
            else
                return 0;
        }
		/// <summary> 
        /// 批量处理  
        /// </summary> 
        public int ExecuteSqlTran(List<string> ls, ref string error)
        {
            return DbHelperSQL.ExecuteSqlTran(ls, ref error);
        }
		/// <summary> 
        /// 分页获取数据列表 
        /// </summary> 
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby))
            {
                strSql.Append("order by " + orderby);
            }
            else
            {
                strSql.Append("order by T.DjLsh desc");
            }
            strSql.Append(")AS Row, T.*  from zwcl_kczbH  T ");
            if (!string.IsNullOrEmpty(strWhere))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex); 
			return DbHelperSQL.Query(strSql.ToString());
        }
		/// <summary> 
        /// 获得数据列表 
        /// </summary> 
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * ");
            strSql.Append(" FROM zwcl_kczbH ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }
			/// <summary> 
  		/// 直接执行sql语句 
  		/// </summary> 
  		public int ExecuteSql(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteSql(sql); 
  		}
        /// <summary> 
        /// 直接执行sql语句 
        /// </summary> 
        public DataTable ExecuteDt(string sql)
        {
            return DbHelperSQL.ExecuteDt(sql);
        }

  
	}
}
		